package org.jeecg.modules.friends;

import org.jeecg.modules.friends.service.VipUserService;
import org.jeecg.modules.friends.utils.ServerTool;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import lombok.extern.slf4j.Slf4j;

/**
 * Created on 2024-08-17
 */
@EnableScheduling
@Component
@Slf4j
public class SendCouponTask {
    @Autowired
    private VipUserService vipUserService;

    @Scheduled(cron = "0 01 01 * * ?")
    public void sendTicket() {
        try {
            if (!ServerTool.isBird02()) {
                log.info("不是 bird02 不执行....");
                return;
            }
            log.info("开始执行任务....");
            vipUserService.sendTicket();
            log.info("结束执行任务....");
        } catch (Exception e) {
            log.error("sendTicket error.", e);
        }
    }
}
